<include file="../header"/>
<body>
<div class="wraper">
    <div class="top">
        <p>全部订单</p>
    </div>
    <div class="order-dtl">
        <p class="bold text-center text-16">订餐领取</p>
        <hr/>
        <div>
            <volist name="orderGoodsList" id="vo">
                <div class="lists tb-mode">
                    <a href="#" class="tb-cell list-left">
                        <div class="img-box"><img src="{BEESCRM:$vo['goods_logo']}"></div>
                    </a>
                    <a href="#" class="tb-cell list-center">
                        <p>{BEESCRM:$vo['goods_name']}</p>
                    </a>
                    <div class="tb-cell list-right">
                        <p>{BEESCRM:$vo['goods_num']}份</p>
                    </div>
                </div>
            </volist>
        </div>
        <hr/>
        <p style="color: #990000;font-size: 16px">预订用餐时间：{BEESCRM:$orderInfo['take_time']}</p>
        <p>付款方式：{BEESCRM:$orderInfo['pay_method']}</p>
        <p>订单编号：{BEESCRM:$orderInfo['order_sn']}</p>
        <p>支付时间：{BEESCRM:$orderInfo['pay_time']|date="Y-m-d H:i:s",###}</p>
        <p>外带：
            <if condition="$orderInfo.take_out eq 1">
                是
                <else/>
                否
            </if>
        </p>
        <if condition="$orderInfo.take_out eq 1">
            <p><span class="field">外带地址：</span>{BEESCRM:$orderInfo.sendAddress}</p>
        </if>
        <hr/>
        <p>备注：{BEESCRM:$orderInfo['memo']}</p>
    </div>
    <div class="wave-bottom"></div>

    <div class="btn-box">
        <a href="javascript:void(0);" id="enter_dinner" class="btn green-btn">确认配餐</a>
    </div>
</div>

<include file="../commonJS" />

<script type="text/javascript">
    $('#enter_dinner').on('click',function(){
        var orderId = {BEESCRM:$orderId};
        var opUrl = "{BEESCRM::U('/Schoolirs/Manage/doReceiveOrder',array('res_id'=>$resId))}";
        $.ajax({
            method: 'POST',
            url: opUrl,
            dataType: 'json',
            data: {'order_id':orderId},
            beforeSend: function() {
                fm.showLoging('提交中...');
            },
            success: function(json) {
                fm.closeLayer();

                if(json.status == 'S'){
                    setTimeout('location.href="{BEESCRM::U('/Schoolirs/Order/orderComplete',array('res_id'=>$resId))}"',1000);
                }else{
                    fm.alert(json.message,'',3);
                }
            },
            error: function(res) {
                fm.closeLayer();
                fm.alert(res.message,'',3);
            }
        });
    });
</script>
</body>
</html>
